package com.edu.exam.enums.student;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 毕业状态枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum GraduationStatus implements BaseEnum {

    NOT_GRADUATED("NOT_GRADUATED", "未毕业"),
    PENDING("PENDING", "待毕业"),
    GRADUATED("GRADUATED", "已毕业"),
    DEFERRED("DEFERRED", "延期毕业"),
    CERTIFIED("CERTIFIED", "已认证"),
    REVOKED("REVOKED", "已撤销");

    private final String code;
    private final String description;

    GraduationStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static GraduationStatus fromCode(String code) {
        for (GraduationStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown GraduationStatus code: " + code);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}
